<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>幻灯片</title>
<link href="css/css.css" rel="stylesheet" type="text/css" />
<script src="move_perfect.js" type="text/javascript"></script>

<script type="text/javascript">
window.onload=function(){
	var oDiv=document.getElementById("div1");
	var aBtn=oDiv.getElementsByTagName("ol")[0].getElementsByTagName("li");
	var oUl=oDiv.getElementsByTagName("ul")[0];
	var now=0;

	for(var i=0;i<aBtn.length;i++){
		aBtn[i].index=i;
		aBtn[i].onclick=function(){
			now=this.index //难道只是把它单独封装出去才设个now变量
			tab();
			};
		};
		function tab(){
			for(var i=0;i<aBtn.length;i++){
				aBtn[i].className="";
				};
			aBtn[now].className='actived';
			move_perfect(oUl, {top: -360*now});
			};
		function next(){
			now++;
			if(now==aBtn.length){
				now=0;
				}
				tab();
			};
		var timer=setInterval(next,2000);
		oDiv.onmouseover=function(){
			clearInterval(timer);
			};
		oDiv.onmouseout=function(){
			timer=setInterval(next,2000)
			};
	}
</script>
</head>

<body style="background:rgb(54, 54, 54);">
<div id="div1">
	<ol>
    	<li class="actived">1</li>
        <li>2</li>
        <li>3</li>
        <li>4</li>
        <li>5</li>
    </ol>
    <ul>
    	<li><img src="images/1.jpg" /></li>
        <li><img src="images/2.jpg" /></li>
        <li><img src="images/3.jpg" /></li>
        <li><img src="images/4.jpg" /></li>
        <li><img src="images/5.jpg" /></li>
    </ul>
</div>
</body>
</html>
